home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 2
/
Amiga Tools 2.iso
/
mui
/
mui-tools
/
multiuser
/
src
/
support
/
kill_freeze_unfreeze.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-09
|
2KB
|
105 lines
/************************************************************
* MultiUser - MultiUser Task/File Support System *
* --------------------------------------------------------- *
* Kill/Freeze/UnFreeze *
* --------------------------------------------------------- *
* © Copyright 1993-1994 Geert Uytterhoeven *
* All Rights Reserved. *
************************************************************/
#include <exec/types.h>
#include <dos/dos.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <libraries/multiuser.h>
#include <proto/multiuser.h>
#include <string.h>
#ifdef _MU_KILL_
#include "Kill_rev.h"
#endif
#ifdef _MU_FREEZE_
#include "Freeze_rev.h"
#endif
#ifdef _MU_UNFREEZE_
#include "Unfreeze_rev.h"
#endif
#include "Locale.h"
char __VersTag__[] = VERSTAG;
int a2num(char *str);
int __saveds Start(char *arg)
{
struct ExecBase *SysBase;
struct DosLibrary *DOSBase;
struct muBase *muBase = NULL;
struct RDArgs *rdargs;
LONG args[] = {
#define argTCB 0
NULL
};
struct Task *task;
int rc = RETURN_ERROR;
SysBase = *(struct ExecBase **)4;
if ((!(DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37))) ||
(!(muBase = (struct muBase *)OpenLibrary("multiuser.library", 39)))) {
rc = ERROR_INVALID_RESIDENT_LIBRARY;
goto Exit;
}
if (!(rdargs = ReadArgs("TCB/A", args, NULL)))
PrintFault(IoErr(), NULL);
else if (!(task = (struct Task *)a2num((char *)args[argTCB])))
PutStr(GetLocStr(MSG_BADARG));
#ifdef _MU_KILL_
else if (!muKill(task))
PutStr(GetLocStr(MSG_KILLFAIL));
#endif
#ifdef _MU_FREEZE_
else if (!muFreeze(task))
PutStr(GetLocStr(MSG_FREEZEFAIL));
#endif
#ifdef _MU_UNFREEZE_
else if (!muUnfreeze(task))
PutStr(GetLocStr(MSG_UNFREEZEFAIL));
#endif
else
rc = RETURN_OK;
FreeArgs(rdargs);
Exit:
CloseLibrary((struct Library *)muBase);
CloseLibrary((struct Library *)DOSBase);
return(rc);
}
int a2num(char *str)
{
BOOL hex = FALSE;
int val = 0;
if (str[0] == '$') {
hex = 1;
str++;
} else if ((str[0] == '0') && ((str[1] == 'x') || (str[1] == 'X'))) {
hex = 1;
str += 2;
}
if (hex) {
if (stch_i(str, &val) != strlen(str))
val = 0;
} else
if (stcd_i(str, &val) != strlen(str))
val = 0;
return(val);
}